package com.yida.gwj.config.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yida.gwj.config.mapper.GwjConfFlowStepMapper;
import com.yida.gwj.api.domain.GwjConfFlowStep;
import com.yida.gwj.config.service.IGwjConfFlowStepService;

/**
 * 业务流程步骤关联Service业务层处理
 * 
 * @author hmh
 * @date 2023-01-12
 */
@Service
public class GwjConfFlowStepServiceImpl implements IGwjConfFlowStepService 
{
    @Autowired
    private GwjConfFlowStepMapper gwjConfFlowStepMapper;

    /**
     * 查询业务流程步骤关联
     * 
     * @param stepId 业务流程步骤关联主键
     * @return 业务流程步骤关联
     */
    @Override
    public GwjConfFlowStep selectGwjConfFlowStepByStepId(Long stepId)
    {
        return gwjConfFlowStepMapper.selectGwjConfFlowStepByStepId(stepId);
    }

    /**
     * 查询业务流程步骤关联列表
     * 
     * @param gwjConfFlowStep 业务流程步骤关联
     * @return 业务流程步骤关联
     */
    @Override
    public List<GwjConfFlowStep> selectGwjConfFlowStepList(GwjConfFlowStep gwjConfFlowStep)
    {
        return gwjConfFlowStepMapper.selectGwjConfFlowStepList(gwjConfFlowStep);
    }

    /**
     * 新增业务流程步骤关联
     * 
     * @param gwjConfFlowStep 业务流程步骤关联
     * @return 结果
     */
    @Override
    public int insertGwjConfFlowStep(GwjConfFlowStep gwjConfFlowStep)
    {
        return gwjConfFlowStepMapper.insertGwjConfFlowStep(gwjConfFlowStep);
    }

    /**
     * 修改业务流程步骤关联
     * 
     * @param gwjConfFlowStep 业务流程步骤关联
     * @return 结果
     */
    @Override
    public int updateGwjConfFlowStep(GwjConfFlowStep gwjConfFlowStep)
    {
        return gwjConfFlowStepMapper.updateGwjConfFlowStep(gwjConfFlowStep);
    }

    /**
     * 批量删除业务流程步骤关联
     * 
     * @param stepIds 需要删除的业务流程步骤关联主键
     * @return 结果
     */
    @Override
    public int deleteGwjConfFlowStepByStepIds(Long[] stepIds)
    {
        return gwjConfFlowStepMapper.deleteGwjConfFlowStepByStepIds(stepIds);
    }

    /**
     * 删除业务流程步骤关联信息
     * 
     * @param stepId 业务流程步骤关联主键
     * @return 结果
     */
    @Override
    public int deleteGwjConfFlowStepByStepId(Long stepId)
    {
        return gwjConfFlowStepMapper.deleteGwjConfFlowStepByStepId(stepId);
    }

	@Override
	public List<GwjConfFlowStep> selectGwjConfFlowStepListByFlowId(Long flowId) {
		return gwjConfFlowStepMapper.selectGwjConfFlowStepListByFlowId(flowId);
	}

	@Override
	public int batchGwjConfFlowStep(List<GwjConfFlowStep> gcFlowSteps) {
		return gwjConfFlowStepMapper.batchGwjConfFlowStep(gcFlowSteps);
	}
	
	@Override
	public int batchGwjConfFlowStep(Long flowId, List<GwjConfFlowStep> gcFlowSteps) {
		if(flowId>0) {
			deleteGwjConfFlowStepByFlowId(flowId);
		}
		if(gcFlowSteps.size()>0) {
			gcFlowSteps.forEach(temp -> temp.setFlowId(flowId));
		}
		return gwjConfFlowStepMapper.batchGwjConfFlowStep(gcFlowSteps);
	}

	@Override
	public int deleteGwjConfFlowStepByFlowId(Long flowId) {
		return gwjConfFlowStepMapper.deleteGwjConfFlowStepByFlowId(flowId);
	}

}
